package cn.lyf.dao;

import cn.lyf.entity.Replay;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;



@Repository
public class ReplayDaoImpl implements ReplayDao {
    @Autowired
    MongoTemplate mongoTemplate;

    @Override
    public Replay add(Replay replay) {
        return mongoTemplate.save(replay);
    }

    @Override
    public Replay findById(String id) {
        Query query = new Query(Criteria.where("id").is(id));
        return mongoTemplate.findOne(query,Replay.class);
    }
}
